﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Control_index_news : System.Web.UI.UserControl
{
    private int _fetchNumber = 9;
    /// <summary>
    /// 显示的文章数目
    /// </summary>
    public int FetchNumber
    {
        get
        {
            return this._fetchNumber;
        }
        set
        {
            this._fetchNumber = value;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindNews(1, rpNews1);
            BindNews(2, rpNews2);
            BindNews(3, rpNews3);
        }
    }

    protected void BindNews(int categoryID,Repeater rp)
    {
        MatchIns.BLL.TArticle bll = new MatchIns.BLL.TArticle();
        MatchIns.BLL.PageInfo pi = new MatchIns.BLL.PageInfo(this.FetchNumber, 1);
        pi.Where = " where ArticleCategoryId="+categoryID.ToString();
        rp.DataSource = bll.GetPageList(pi).List;
        rp.DataBind();

    }
}